<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>
<a href="index.php?com=template"><b>List template</b></a> | <a href="index.php?com=template&func=add"><b>Add new template</b></a>
<br />
<?php
	include_once("process/template.php");	
	$template = new template();	
    $pager = new PS_Pagination($template->_connection, $template->GetListPaging(), 15, 5, "", "?com=template");
	
	$rs = $pager->paginate();

	$table = '<table width="50%" style="font-size:10pt;">
				<tr>
					<td align="center" colspan="6" height="50"><b style="font-size:12pt; color:Blue;">List template</b></td>
				</tr>
				<tr bgcolor="#996699" style=" font-weight:bold;">						
					<td style="padding:4px;">Template name</td>
                    <td style="padding:4px;">Template path</td>
                    <td style="padding:4px;">Template Description</td>
                    <td style="padding:4px;">Template Image</td>
					<td style="padding:4px;" align="center" width="70px" colspan="2"></td>
				</tr>';
   while($list = mysql_fetch_assoc($rs))
	{
		$table .= '	<tr bgcolor="#FFFFFF"  onMouseOver="this.bgColor = '."'#C0C0C0'".'" onMouseOut ="this.bgColor = '."'#FFFFFF'".'">
						
						<td style="padding:4px;">
							'.$temp['template_name'].'
						</td>
                        <td style="padding:4px;">
							'.$temp['template_path'].'
						</td>
                        <td style="padding:4px;">
							'.$temp['template_description'].'
						</td>
                        <td style="padding:4px;">
							'.$temp['template_image'].'
						</td>
						<td align="center">
							<a style="color:#0033FF;" href="index.php?com=template&func=update&id='.$temp['template_id'].'">
								Sửa
							</a>
						</td>
						<td align="center">
							<a onClick="'."return confirm('Bạn có muốn xóa thể loại này không ?')".'"  style="color:#0033FF" href="index.php?com=template&func=delete&id='.$temp['template_id'].'">
								Xóa
							</a>
						</td>
					</tr>';
	}
    //endforeach;
	$table .= '</table>';
	echo $table.'<br />';
	echo $pager->renderFullNav();
    }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}
?>